COMPILER=g++
C_FLAGS=-I./ -I./src -I/opt/local/include -Wall -Wextra -pedantic -ansi -O2
L_FLAGS=-L/opt/local/lib -lboost_system

all: Makefile greedy b8b dynamic

dynamic: objs/structs.o objs/algo_dynamique.o 
	${COMPILER} ${C_FLAGS} ${L_FLAGS} $^ -o $@

b8b: objs/structs.o objs/greedy.o src/b8b.cc
	${COMPILER} ${C_FLAGS} ${L_FLAGS} $^ -o $@

greedy: objs/structs.o objs/greedy.o src/main_greedy.cc
	${COMPILER} ${C_FLAGS} ${L_FLAGS} $^ -o $@

objs/structs.o: src/structs.cc src/structs.hh
	${COMPILER} -c -I/opt/local/include $< -o $@

objs/%.o: src/%.cc src/%.hh
	${COMPILER} -c ${C_FLAGS} $< -o $@
	
.PHONY: clean mrproper

clean:
	-@rm objs/*.o 2>/dev/null
	-@rm -r *.dSYM/ 2>/dev/null

mrproper: clean
	-@rm greedy 2>/dev/null
	-@rm dynamic 2>/dev/null
	-@rm b8b 2>/dev/null
